package com.qcby.controller;

import com.qcby.entity.Checkings;
import com.qcby.entity.PageResult;
import com.qcby.entity.Query.CheckingQuery;
import com.qcby.entity.Result;
import com.qcby.service.CheckingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/checking")
public class CheckingController {
    @Autowired
    private CheckingService checkingService;
    @RequestMapping("/list")
    public Result list(CheckingQuery checkingQuery){
        System.out.println(checkingQuery+"用户打卡的形式");
        PageResult<Checkings> list = checkingService.list(checkingQuery);
        return Result.success(list);
    }
    @RequestMapping("/get/{id}")
    public Result getById(@PathVariable("id") int id){
        System.out.println(id+"用户打卡的id");
        Checkings check = checkingService.getById(id);
        return Result.success(check);
    }
    @RequestMapping("/delete/{id}")
    public Result delete(@PathVariable("id") int id){
        checkingService.delete(id);
        return Result.success();
    }
}
